angular.module('Controller',[])
//文章分类的控制器
.controller('ArticleCtrl',['$scope','Article', function($scope,Article){
	Article.fenlei();
	$scope.$on('fenleiData', function(event,data){
		$scope.articleFenList = data;
	})
}])
//文章列表的控制器
.controller('ArticleListCtrl',['$scope','Article','$stateParams', function($scope,Article,$stateParams){
	Article.list($stateParams.id,1);
	$scope.$on('list', function(event,data){
		$scope.list = data;
	});
}])
//文章详情控制页
.controller('articleDetail',['$scope','Article','$stateParams', function($scope,Article,$stateParams){
	Article.detail($stateParams.tid);
	$scope.$on('detail', function(event,data){
		$scope.detail = data;
	});
}])



//论坛分类控制器
.controller('luntanFen',['$scope','luntan',function($scope,luntan){
	luntan.fen();
	$scope.$on("fen",function(event,res){
		$scope.fen = res;
	})
}])

.controller('luntanList',['$scope','luntan','$stateParams',function($scope,luntan,$stateParams){
	luntan.list($stateParams.fid,1);
	$scope.$on('LuntanList',function(event,res){
		$scope.LuntanList = res;
	})
}])
.controller('luntanDetail',['$scope','$stateParams','luntan',function($scope,$stateParams,luntan){
	luntan.detail($stateParams.tid)
	$scope.$on('detail',function(event,res){
		$scope.detail=res;
	})
}])


